package mytest.huaweiG.GraphB;

/**
 * http://blog.csdn.net/kimylrong/article/details/17220455
 *
 */
enum Color {
    WHITE, GRAY, BLACK
}

class Vertex {
  private String name;
  private Color color;
  private Vertex parent;
  private int discover;
  private int finish;

  public Vertex(String name) {
      this.name = name;
      this.color = Color.WHITE;
  }

  public String getName() {
      return name;
  }

  public void setName(String name) {
      this.name = name;
  }

  public Color getColor() {
      return color;
  }

  public void setColor(Color color) {
      this.color = color;
  }

  public Vertex getParent() {
      return parent;
  }

  public void setParent(Vertex parent) {
      this.parent = parent;
  }

  public int getDiscover() {
      return discover;
  }

  public void setDiscover(int discover) {
      this.discover = discover;
  }

  public int getFinish() {
      return finish;
  }

  public void setFinish(int finish) {
      this.finish = finish;
  }

  @Override
  public int hashCode() {
      final int prime = 31;
      int result = 1;
      result = prime * result + ((name == null) ? 0 : name.hashCode());
      return result;
  }

  @Override
  public boolean equals(Object obj) {
      if (this == obj)
          return true;
      if (obj == null)
          return false;
      if (getClass() != obj.getClass())
          return false;
      Vertex other = (Vertex) obj;
      if (name == null) {
          if (other.name != null)
              return false;
      } else if (!name.equals(other.name))
          return false;
      return true;
  }
}

